package com.itcam.phaselist.set_;

@SuppressWarnings("{all}")
public class HashSetStructure {
    public static void main(String[] args) {
        // 模拟HashMap（即HashSet底层结构）底层结构
        // 1.创建一个数组，类型是Node[]
        Node[] table = new Node[16];
        System.out.println("table = " + table);

        // 2.创建节点
        Node cammy = new Node("cammy", null);

        table[2] = cammy;

        Node kim = new Node("KIM", null);
        cammy.next = kim;

        Node hsp = new Node("HSP", null);
        kim.next = hsp;

        System.out.println("table = " + table);

    }
}

class Node { // 模拟一个节点，可以指向下一个节点，从而形成链表
    Object item; // 存放数据
    Node next; // 指向下一个节点

    public Node(Object item, Node next) {
        this.item = item;
        this.next = next;
    }
}